#include <iostream>
#include <map>
using namespace std;
int main()
{
    int m, n, t, k = 1, count[100] = {0}, max = -1, r;
    map<int, int> id;
    id[0] = 0;
    scanf("%d%d", &m, &n);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
        {
            scanf("%d", &t);
            if (t != 0 && id[t] == 0)
            {
                id[t] = k;
                count[k]++;
                k++;
            }
            else
            {
                count[id[t]]++;
            }
            if (count[id[t]] > max)
            {
                max = count[id[t]];
                r = t;
            }
        }
    cout << r;
    return 0;
}